package com.meetablog.util;

import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class SqlMapConfig {
	
	private static final SqlMapClient sqlMap;
	
	static {
		
		try{
			
			String resource = "sqlmap-config.xml";
			Reader reader = Resources.getResourceAsReader(resource);
			sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException("SqlMapConfig class 에서 에러 났음 => " + e);
		}
	}
	
	public static SqlMapClient getSqlMapClient(){
		return sqlMap;
	}

}
